import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:rjpb/shared/extensions/extensions.dart';
import 'package:rjpb/components/gap.dart';
import 'package:jovial_svg/jovial_svg.dart'; //svg

class ZEmpty extends StatelessWidget {
  const ZEmpty({
    super.key,
    this.gapH = 0,
    this.width,
    this.height,
  });
  final double gapH;
  final double? width;
  final double? height;

  @override
  Widget build(BuildContext context) {
    return SizedBox.expand(
      // 占满父容器
      child: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center, // 垂直居中
          children: [
            Gap.h(gapH),
            // SizedBox(
            //   width: width ?? double.infinity, // 默认填满
            //   height: height ?? double.infinity, // 默认填满
            //   child: SvgPicture.asset(
            //     "assets/svgs/placeholder.svg",
            //     fit: BoxFit.contain, // 保持 SVG 比例
            //   ),
            // ),
            Padding(
              // 添加左右边距
              padding: const EdgeInsets.symmetric(horizontal: 20), // 左右各 20 像素
              // child: SizedBox(
              //   width: width ?? double.infinity,
              //   height: height ?? double.infinity,
              //   child: SvgPicture.asset(
              //     "assets/svgs/placeholder.svg",
              //     fit: BoxFit.contain,
              //   ),
              // ),
              child: ScalableImageWidget.fromSISource(
                si: ScalableImageSource.fromSvgHttpUrl(Uri.parse(
                    'https://gitee.com/tsy9907/img/raw/master/placeholder.svg')),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
